Skip to content

Conversation

@rachelmcr
Copy link
Contributor

Part of: #8363

Description

This PR adds support in the Networking layer for getting views (in addition to visitors) when requesting SiteVisitStats from the API (the "visits" endpoint: GET /rest/v1.1/sites/{SITE}/stats/visits).

This allows us to get the views and visitors stats we need in the Analytics Hub for the quarter time period. We can get these stats for other time periods from the "summary" endpoint added in #8372, but that endpoint doesn't support quarters.

Instead, for quarters we can make a request to this "visits" endpoint to get the stats for every month in the quarter, and sum the monthly stats to get the quarterly totals.

We currently store SiteVisitStats in Core Data; support for views in the Storage layer will be added in a following PR.

Changes

  1. Updates the request parameters in SiteStatsRemote to request both the visitors and views fields from this endpoint.
  2. Adds views to the SiteVisitStatsItem model (and updates SiteVisitStats to decode them).
  3. Updates the related fakes, copiables, mocks, and unit tests to include views.

Testing

Views aren't yet stored or used in the app, so make sure unit tests have expected changes and still pass.

Submitter Checklist

Update release notes:

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@rachelmcr rachelmcr added the feature: stats Related to stats, including Top Performers. label Dec 12, 2022
@rachelmcr rachelmcr added this to the 11.7 milestone Dec 12, 2022
@rachelmcr rachelmcr marked this pull request as ready for review December 12, 2022 16:21
@ealeksandrov ealeksandrov self-assigned this Dec 13, 2022
Copy link
Contributor

@ealeksandrov ealeksandrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@ealeksandrov ealeksandrov removed their assignment Dec 13, 2022
@rachelmcr rachelmcr force-pushed the issue/8363-jetpack-stats-views branch from ca7dbc2 to cecfaa8 Compare December 13, 2022 13:04
@rachelmcr rachelmcr enabled auto-merge December 13, 2022 13:06
@wpmobilebot
Copy link
Collaborator

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr8386-cecfaa8 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@rachelmcr rachelmcr merged commit f94cbc2 into trunk Dec 13, 2022
@rachelmcr rachelmcr deleted the issue/8363-jetpack-stats-views branch December 13, 2022 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: stats Related to stats, including Top Performers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants